import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 市场资讯信息 */
export interface MarketInformation {
          id: number; // 咨讯id
          informationName: string; // 咨询名称
          sort?: number; // 显示顺序
          status?: number; // 显示状态（0正常 1停用）
          recommendedStatus?: number; // 首页是否推荐（0正常 1停用）
          imagePath?: string; // 图片地址
          details?: string; // 详情
  }

// 市场资讯 API
export const MarketInformationApi = {
  // 查询市场资讯分页
  getMarketInformationPage: async (params: any) => {
    return await request.get({ url: `/biz/market-information/page`, params })
  },

  // 查询市场资讯详情
  getMarketInformation: async (id: number) => {
    return await request.get({ url: `/biz/market-information/get?id=` + id })
  },

  // 新增市场资讯
  createMarketInformation: async (data: MarketInformation) => {
    return await request.post({ url: `/biz/market-information/create`, data })
  },

  // 修改市场资讯
  updateMarketInformation: async (data: MarketInformation) => {
    return await request.put({ url: `/biz/market-information/update`, data })
  },

  // 删除市场资讯
  deleteMarketInformation: async (id: number) => {
    return await request.delete({ url: `/biz/market-information/delete?id=` + id })
  },

  /** 批量删除市场资讯 */
  deleteMarketInformationList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/market-information/delete-list?ids=${ids.join(',')}` })
  },

  // 导出市场资讯 Excel
  exportMarketInformation: async (params) => {
    return await request.download({ url: `/biz/market-information/export-excel`, params })
  },
}